home *** CD-ROM | disk | FTP | other *** search
- /********************************************************* DEFINITION
- DATE: 9/17/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPText
-
- SUPERCLASS: CPPVisualObject
-
- This C++ class manages a textedit area, and a horizontal and
- vertical scrollbar which let you adjust the text.
-
- ********************************************************************/
-
- #pragma once
-
- #include <CPPVisualObject.h>
-
- class CPPWindow;
-
- class CPPText : public CPPVisualObject{
- public:
- CPPText (CPPWindow *OurWindow,
- Rect *ViewArea,
- Rect *DestArea,
- short maxLength = 32000,
- Boolean UseHScroll = TRUE,
- Boolean UseVScroll = TRUE,
- short Font = geneva,
- short FSize = 9);
- CPPText (CPPWindow *OurWindow,
- short maxLength = 32000,
- Boolean UseHScroll = TRUE,
- Boolean UseVScroll = TRUE,
- short Font = geneva,
- short FSize = 9);
- ~CPPText (void);
-
- virtual char *ClassName (void);
-
- virtual Boolean DoCommand (short commandID);
-
- virtual void TypeChar (unsigned char TheKey);
-
- void DoCut (void);
- void DoCopy (void);
- virtual void DoPaste (void);
- void DoClear (void);
- void DoSelectAll (void);
-
- CharsHandle GetTheText (void);
- short GetTextLen (void);
- virtual Boolean DoKey (char theKey, short modifiers, short what);
- virtual void Activate (Boolean nowActive);
- virtual Boolean DoClick (EventRecord *theEvent);
- virtual void DoIdle (void);
- virtual Rect *GetBounds (void);
-
- virtual void Draw (void);
- virtual void MakeVisible (Boolean nowVisible);
- virtual void TargetHilite (Boolean makeTarget);
-
- virtual void InsertTextPtr (Ptr theText, long textLen,
- long insertWhere,
- Boolean ScrollToInsertion);
- void InsertTextHandle (Handle theText, long textLen,
- long where,
- Boolean ScrollToInsertion);
- virtual void SetTextPtr (Ptr theText, long textLen,
- Boolean ScrollToInsertion);
- void SetTextHandle (Handle theText, long textLen,
- Boolean ScrollToInsertion);
-
- void SetMinSize (short mwidth, short mheight);
- void SetMaxSize (short mwidth, short mheight);
-
- void MoveScrollText (void);
-
- protected:
- TEHandle TextBlock;
- ControlHandle HScroll;
- ControlHandle VScroll;
- short maxTextLen;
-
- virtual void ResizeContent (short newWidth, short newHeight);
- virtual void MoveContent (short newH, short newV);
-
- void CheckInsertion (void);
- void ScrollChar (short charPos, Boolean toBottom);
-
- private:
- short TEminWidth,
- TEmaxWidth,
- TEminHeight,
- TEmaxHeight;
-
- static CPPText *gCurrentTE;
- static ControlHandle gVScroll;
- static ControlHandle gHScroll;
- static TEHandle gTextBlock;
-
- // static class methods
- static pascal Boolean AutoScroll (void);
- static pascal void Scroll_Right (ControlHandle theControl,
- short ctlPart);
- static pascal void Scroll_Left (ControlHandle theControl,
- short ctlPart);
- static pascal void Scroll_Up (ControlHandle theControl,
- short ctlPart);
- static pascal void Scroll_Down (ControlHandle theControl,
- short ctlPart);
-
- void MakeTEArea (CPPWindow *OurWindow,
- Rect *ViewArea,
- Rect *DestArea,
- short maxLength,
- Boolean UseHScroll,
- Boolean UseVScroll,
- short Font,
- short FSize);
- long LinesInWindow(void);
- long LinesInText (void);
- void VPageScroll (long part, long direction);
- void HPageScroll (long part, long direction);
- void AdjustScrollBar (void);
- void DoVScroller (Point clickPt, short part);
- void DoHScroller (Point clickPt, short part);
-
- };